package com.ems.pojo.data;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * @Auther: 伟伟
 * @Date: 2019/10/7
 * @Description: 描述
 * @Version: 1.0
 */
public class ReturnPageResult {
    public static void setPageHelperInfo(RequestData requestData){
       PageHelper.startPage(requestData.getPageNum(),requestData.getPageSize());
    }

    public static ResultData AssemblyData(Object list){

        List<Object> list1 = (List<Object>)list;

        //创建PageInfo
        PageInfo<Object> info = new PageInfo<Object>(list1);

        long total = info.getTotal();
        long pageNum = info.getPageNum();

        ResultData resultData = new ResultData(200,new PageData(total,pageNum,list1));
        return resultData;
    }

}
